package io.renren.modules.sys.service.impl;

import io.renren.modules.business.util.PageLastUtil;
import io.renren.modules.sys.dao.SysLaboratoryDao;
import io.renren.modules.sys.entity.SysCollegeEntity;
import io.renren.modules.sys.entity.SysLaboratoryEntity;
import io.renren.modules.sys.service.SysLaboratoryService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;


@Service("sysLaboratoryService")
public class SysLaboratoryServiceImpl extends ServiceImpl<SysLaboratoryDao, SysLaboratoryEntity> implements SysLaboratoryService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        List<Map<String, Object>> list;
        String laboratoryName = (String) params.get("laboratoryName");
        if (laboratoryName == null || laboratoryName.equals("")){
            list = baseMapper.laboratoryList();
        }else {
            list = baseMapper.keyLaboratoryList(laboratoryName);
        }
        return PageLastUtil.getPageUtils(params, list);
    }

    @Override
    public List<Map<String, Object>> seleAllLab() {
        return baseMapper.laboratoryList();
    }

    /**
     * 查询所有学院信息
     * @return
     */
    @Override
    public List<SysLaboratoryEntity> queryListLaboratory() {
        return baseMapper.queryListLaboratory();
    }
}